<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:PlanetWPF.Toolbelt.Controls"
    >

  <!--Default DateTemplate for GridCell-->
  <DataTemplate x:Key="DefaultCellTemplate">
    <local:PowerGridCell
      CellColumn="{Binding}"
      ParentRow="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:PowerGridRow}}}"
      Item="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:PowerGridRow}}, Path=Item}"
          />
  </DataTemplate>

  <Style TargetType="{x:Type local:PowerGrid}">
    <Setter Property="CellDataTemplate" Value="{StaticResource DefaultCellTemplate}"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type local:PowerGrid}">
          <Border Background="{TemplateBinding Background}"
                  BorderBrush="{TemplateBinding BorderBrush}"
                  BorderThickness="{TemplateBinding BorderThickness}">
            <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
              <StackPanel Orientation="Vertical" Height="{TemplateBinding Height}">
                <local:PowerGridColumnHeaderRow Name="PART_Header" ParentGrid="{Binding RelativeSource={RelativeSource TemplatedParent}}"  Columns="{TemplateBinding Columns}"/>
                <local:PowerGridView Name="PART_Grid" Columns="{TemplateBinding Columns}" Items="{TemplateBinding Items}" />
              </StackPanel>
            </ScrollViewer>
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

</ResourceDictionary>